﻿using System;
using System.Linq;
using System.Linq.Expressions;
using System.Collections.Generic;

namespace mForum.Core.Repository
{
    using mForum.Core.Specification;

    public interface IRepository<TEntity> where TEntity : class
    {
        TEntity GetById(Guid id);
        IEnumerable<TEntity> GetBySpec(ISpecification<TEntity> spec);
        void Add(TEntity entity);
        void Delete(Guid id);
        void Delete(TEntity entity);
        IEnumerable<TEntity> GetPagedElements<S>(int pageIndex, int pageSize, Expression<Func<TEntity, S>> orderExpression, bool ascending);
        IEnumerable<TEntity> GetPagedElements<S>(int pageIndex, int pageSize, Expression<Func<TEntity, S>> orderExpression, ISpecification<TEntity> specification, bool ascending);
        IEnumerable<TEntity> All();
    }
}
